#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <Windows.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>

struct ListNode
{
    int val;
    struct ListNode* next;
};

int main()
{
    struct ListNode* n1 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(n1);
    struct ListNode* n2 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(n2);
    struct ListNode* n3 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(n3);
    struct ListNode* n4 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(n4);
    struct ListNode* n5 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(n5);
    struct ListNode* b1 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(b1);
    struct ListNode* b2 = (struct ListNode*)malloc(sizeof(struct ListNode));
    assert(b2);

    n1->val = 4;
    n2->val = 1;
    n3->val = 8;
    n4->val = 4;
    n5->val = 5;
    b1->val = 5;
    b2->val = 6;
    n1->next = n2;
    n2->next = n3;
    n3->next = n4;
    n4->next = n5;
    n5->next = NULL;
    b1->next = b2;
    b2->next = n2;
    SListPrint(n1);
    SListPrint(b1);
    struct ListNode* min = getIntersectionNode(n1, b1);
    SListPrint(min);

    return 0;
}
